package org.dtrd.modules.flup.entity.bean;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
import lombok.SneakyThrows;
import org.dtrd.config.system.Constant;
import org.dtrd.modules.flup.entity.po.DtrdEntRdFlupAppointmentRecord;

import java.util.Date;

/**
 * <p>
 * 复诊预约记录
 * </p>
 *
 * @author QR
 * @since 2021-12-16
 */
@Getter
@Setter
@ApiModel(value = "复诊预约记录列表信息", description = "复诊预约记录")
public class FlupAppointmentRecordListInfo {

    private Integer dataId;

    @ApiModelProperty("机构编码")
    private String orgCode;

    @ApiModelProperty("医生id")
    private Integer doctorId;

    @ApiModelProperty("患者id")
    private Integer patientId;

    @ApiModelProperty("复诊预约日期")
    private Date flupDate;

    @ApiModelProperty("复诊时间段")
    private Integer flupTime;

    @ApiModelProperty("开始时间")
    private String startTime;

    @ApiModelProperty("结束时间")
    private String endTime;

    @ApiModelProperty("复诊模版id")
    private Integer flupTemplateId;

    @ApiModelProperty("备注")
    private String remark;


    @SneakyThrows
    public FlupAppointmentRecordListInfo (DtrdEntRdFlupAppointmentRecord po) {
        dataId = po.getDataId();
        orgCode = po.getOrgCode();
        doctorId = po.getDoctorId();
        patientId = po.getPatientId();
        flupDate = po.getFlupDate();
        flupTime = po.getFlupTime();
        Constant.FlupTime time = Constant.FlupTime.valueOf(po.getFlupTime());
        assert time != null;
        startTime = time.getStartTime();
        endTime = time.getEndTime();
        flupTemplateId = po.getFlupTemplateId();
        remark = po.getRemark();
    }
}
